<template>
    <div>
      <el-descriptions title="基本信息">
      <el-descriptions-item label="设备编号">{{fach.facModel}}</el-descriptions-item>
      <el-descriptions-item label="设备厂家">{{fach.facSeller}}</el-descriptions-item>
      <el-descriptions-item label="出厂时间">{{fach.facDate}}</el-descriptions-item>
      <el-descriptions-item label="开启时间">{{fach.frStartTime}}</el-descriptions-item>
      <el-descriptions-item label="关闭时间">{{fach.frEndTime}}</el-descriptions-item>
      <el-descriptions-item label="灯杆编号">{{fach.lpId}}</el-descriptions-item>
      <el-descriptions-item label="连接状态">
        <el-tag size="small">在线</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="所在区域">{{fach.areaName}}</el-descriptions-item>
  </el-descriptions>
  
  <el-descriptions title="运行状态">
      <el-descriptions-item label="监测状态">{{fach.facStateName}}</el-descriptions-item>
      <el-descriptions-item label="PM2.5">{{fach.checkPm}}</el-descriptions-item>
      <el-descriptions-item label="体感温度">{{fach.checkTemp}}</el-descriptions-item>
      <el-descriptions-item label="紫外线">{{fach.checkRays}}</el-descriptions-item>
      <el-descriptions-item label="空气湿度">{{fach.checkAir}}</el-descriptions-item>
      <el-descriptions-item label="气体压强">{{fach.checkPressure}}</el-descriptions-item>
      <el-descriptions-item label="风力风向">{{fach.checkWind}}</el-descriptions-item>
  </el-descriptions>
  <br><br>
  <el-row>
    <el-button type="info" round @click="toBack">返回上一层</el-button>
    <el-button type="danger" @click="dialogFormVisible = true">设值环境监测</el-button>
  </el-row>
  <!-- 修改警告值 -->
  <el-dialog title="设置环境监测" :visible.sync="dialogFormVisible">
  <el-form :model="form">
    <el-form-item label="PM2.5报警值" :label-width="formLabelWidth">
      <el-input v-model="form.errorList.errorPm" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="体感温度报警值" :label-width="formLabelWidth">
      <el-input v-model="form.errorList.errorTemp" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="紫外线报警值" :label-width="formLabelWidth">
      <el-input v-model="form.errorList.errorRays" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="空气湿度报警值" :label-width="formLabelWidth">
      <el-input v-model="form.errorList.errorAir" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="气体压强报警值" :label-width="formLabelWidth">
      <el-input v-model="form.errorList.errorPressure" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="风力风向报警值" :label-width="formLabelWidth">
      <el-input v-model="form.errorList.errorWind" autocomplete="off"></el-input>
    </el-form-item>
  </el-form>
  <div slot="footer" class="dialog-footer">
    <el-button @click="dialogFormVisible = false">取 消</el-button>
    <el-button type="primary" @click="updateE">确 定</el-button>
  </div>
</el-dialog>

    </div>
  </template>
  
  <script>
  export default {
    data() {
      return {
          fach:{},
          dialogFormVisible: false,
        form: {
          errorList:{}
        },
        formLabelWidth: '150px'
          
      };
    },
    methods: {
      toBack(){
          this.$router.push("/environment");
      },
      load(){
          this.fach = JSON.parse(sessionStorage.getItem("fach"));
          this.$axios.get("err").then((res) => {
          this.form.errorList = res.data.data.error;
        });
      },
      updateE(){
        this.$axios.post("err",this.form.errorList).then((res) => {
          if(res.data.code==200){
            this.$message.success("修改成功");
          }
        this.dialogFormVisible=false;
        });
      }
    },
    mounted() {
      this.load();
    }
  };
  </script>
  
  